package com.example.sulingorder.controller;

import com.example.sulingorder.entity.OrderEarthEntity;
import com.example.sulingorder.service.OrderEarthService;
import com.xiao.sulingpublic.utils.PageUtils;
import com.xiao.sulingpublic.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;



/**
 * 订单涉及订单起始点,和目的点
 *
 * @author xiao
 * @email 1322127758@qq.com
 * @date 2022-03-14 15:59:41
 */
@RestController
@RequestMapping("sulingorder/orderearth")
public class OrderEarthController {
    @Autowired
    private OrderEarthService orderEarthService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("sulingorder:orderearth:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = orderEarthService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{ooeId}")
    //@RequiresPermissions("sulingorder:orderearth:info")
    public R info(@PathVariable("ooeId") Long ooeId){
		OrderEarthEntity orderEarth = orderEarthService.getById(ooeId);

        return R.ok().put("orderEarth", orderEarth);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("sulingorder:orderearth:save")
    public R save(@RequestBody OrderEarthEntity orderEarth){
		orderEarthService.save(orderEarth);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("sulingorder:orderearth:update")
    public R update(@RequestBody OrderEarthEntity orderEarth){
		orderEarthService.updateById(orderEarth);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("sulingorder:orderearth:delete")
    public R delete(@RequestBody Long[] ooeIds){
		orderEarthService.removeByIds(Arrays.asList(ooeIds));

        return R.ok();
    }

}
